package com.secxiot.provider;

import com.secxiot.provider.system.dto.AppBannerDto;
import com.secxiot.provider.system.dto.AppNewsDto;
import com.secxiot.provider.system.dto.AppVersionDto;
import com.secxiot.provider.system.dto.FileLogDto;
import com.secxiot.provider.system.entity.AppRecommend;
import com.secxiot.provider.system.entity.FileLog;
import com.secxiot.provider.system.vo.AppRegimeVo;
import com.secxiot.provider.system.vo.DataDictVo;
import com.secxiot.provider.system.vo.FileLogVo;
import com.secxiot.provider.system.vo.FilesStorageVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface SystemApi {

    /**
     * 获取字典列表
     *
     * @param parentCode 父节点
     * @return 列表
     */
    @GetMapping("/dataDict")
    List<DataDictVo> listDataDict(String parentCode);

    /**
     * 保存文件上传记录
     *
     * @param fileLog 上传记录
     * @return 记录id
     */
    @PostMapping
    Long saveFileLog(FileLog fileLog);

    /**
     * 获取文件uri
     *
     * @param logId
     * @return 返回文件相关信息
     */
    FileLogDto getFileUri(Long logId);

    /**
     * 使用上传文件
     *
     * @param logIds 上传日志id列表
     * @return 修改数量
     */
    @PostMapping("/filelog/use")
    Long useFileLogs(@RequestParam List<Long> logIds);

    /**
     * 获取文件信息
     *
     * @param code 文件编码
     * @return 修改数量
     */
    @GetMapping("/filelog/fileLogByCode")
    List<FileLogVo> selectFileByCode(String code);

    @GetMapping("/app/version")
    AppVersionDto getAppVersion(@RequestParam String platform, @RequestParam String clientType);

    @GetMapping("/app/banner")
    List<AppBannerDto> getAppBanner(@RequestParam(value = "userId", required = true) Long userId,
                                    @RequestParam(value = "hospitalId", required = false) Long hospitalId);

    @GetMapping("/app/news")
    List<AppNewsDto> getAppNews(@RequestParam(value = "userId", required = true) Long userId,
                                @RequestParam(value = "hospitalId", required = false) Long hospitalId);

    /**
     * 获取今日推荐列表
     *
     * @param userId     用户id
     * @param hospitalId 医院id
     * @param pageNo     页码
     * @param pageSize   条数
     * @return
     */
    @GetMapping("/app/recommendList")
    List<AppRecommend> getAppRecommends(
            @RequestParam(value = "userId", required = true) Long userId,
            @RequestParam(value = "hospitalId", required = false) Long hospitalId,
            @RequestParam(value = "pageNo", required = true) Long pageNo,
            @RequestParam(value = "pageSize", required = true) Long pageSize
    );

    /**
     * 获取今日推荐对象
     *
     * @param recommendId 推荐id
     * @return
     */
    @GetMapping("/app/recommend/detail")
    AppRecommend getAppRecommendById(@RequestParam(value = "recommendId", required = true) Long recommendId);


    /**
     * 资料库--列表
     *
     * @param userId     用户ID
     * @param hospitalId 医疗机构ID
     * @param pageNo     页数
     * @param pageSize   条数
     * @param isPage     是否分页  0 否  1 是
     * @param searchName 关键字
     * @return
     */
    @ApiOperation(value = "资料库--列表", httpMethod = "GET")
    @GetMapping("/filesStorage/list")
    List<FilesStorageVo> selectFilesStorage(@RequestParam(value = "userId", required = false) Long userId,
                                            @RequestParam(value = "hospitalId", required = false) Long hospitalId,
                                            @RequestParam(value = "pageNo", required = false) Integer pageNo,
                                            @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                            @RequestParam(value = "isPage", required = true) Integer isPage,
                                            @RequestParam(value = "searchName", required = false) String searchName);

    /**
     * 资料库--详情
     *
     * @param id 资料库ID
     * @return
     */
    @ApiOperation(value = "资料库--详情", httpMethod = "GET")
    @GetMapping("/filesStorage/detail")
    FilesStorageVo getFilesStorageById(@RequestParam(value = "id") Long id);

    /**
     * 资料库--添加
     *
     * @param filesStorageVo
     * @return
     */
    @ApiOperation(value = "资料库--添加", httpMethod = "POST")
    @PostMapping("/filesStorage/save")
    Long insertFilesStorage(@RequestBody FilesStorageVo filesStorageVo);


    /**
     * 资料库--修改
     *
     * @param filesStorageVo
     * @return
     */
    @ApiOperation(value = "资料库--详情", httpMethod = "POST")
    @PostMapping("/filesStorage/update")
    Long updateFilesStorage(@RequestBody FilesStorageVo filesStorageVo);

    /********************************医院文化制度***************************************/

    /**
     * 医院文化制度--列表
     *
     * @param type       数据字典 00015
     * @param hospitalId 医疗机构ID
     * @param pageNo     页数
     * @param pageSize   条数
     * @param isPage     是否分页  0 否  1 是
     * @param searchName 关键字
     * @return
     */
    @ApiOperation(value = "医院文化制度--列表", httpMethod = "GET")
    @GetMapping("/appRegime/list")
    List<AppRegimeVo> selectAppRegime(@RequestParam(value = "type", required = true) String type,
                                      @RequestParam(value = "hospitalId", required = false) Long hospitalId,
                                      @RequestParam(value = "pageNo", required = false) Integer pageNo,
                                      @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                      @RequestParam(value = "isPage", required = true) Integer isPage,
                                      @RequestParam(value = "searchName", required = false) String searchName);

    /**
     * 医院文化制度--详情
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "医院文化制度--详情", httpMethod = "GET")
    @GetMapping("/appRegime/detail")
    AppRegimeVo getAppRegimeById(@RequestParam("id") Long id);

    /**
     * 删除文件
     *
     * @param fileId
     * @return
     */
    @ApiOperation(value = "删除文件", httpMethod = "GET")
    @GetMapping("/deleteFile")
    int deleteFile(@RequestParam("fileId") Long fileId);
}
